<?php

namespace model;

class Loginmodel {
	/**
	 * @var string
	 */
	private static $realUserName = "Admin";
	/**
	 * @var string
	 */
	private static $realPassword = "Password";
	/**
	 * @var string
	 */
	private static $arrayusername = "username";
	/**
	 * @var string
	 */
	private static $arraypassword = "password";
	/**
	 * @var string
	 */
	private static $passwordComparing = "e6c83b282aeb2e022844595721cc00bbda47cb24537c1779f9bb84f04039e1676e6ba8573e588da1052510e3aa0a32a9e55879ae22b0c2d62136fc0a3e85f8bb";

	/**
	 * @param $usrName string
	 * @param $passWord string
	 * @throws Exception
	 */
	public function validateUsrInfo($usrName, $passWord) {
		if(empty($usrName)) {
			throw new \Exception("1");
		}
		else if(empty($passWord)) {
			throw new \Exception("2");
		}
		else if($usrName != self::$realUserName || 
				$passWord != self::$realPassword) {
			throw new \Exception("3");
		}
	}

	public function loginUserWithCookie($cookieUserName, $cookiePassword) {
		return $cookieUserName == self::$realUserName
			&& $cookiePassword == self::$passwordComparing;
	}
}
?>